﻿package net.area80.serverside.datatype
{
	import net.area80.serverside.ServerSide;
	
	/**
	* SendVariable
	* @author Wissarut Pimanmassuriya
	*/
	public class SendVariable extends DataTypeObject
	{
		public var name:String;
		public var data:String;
		
		public function SendVariable (name:String , data:String):void {
			this.name = name;
			this.data = data;
		}
		public static function getSendVariable (o:Object):SendVariable {
			if (o is Array) return new SendVariable((o as Array)[0], (o as Array)[1]);
			if (o["name"] && o["data"]) {
					return new SendVariable(o["name"], o["data"]);
			} else {
					ServerSide.log('URL variables must be format in ["name","data"] or {name:"name", data:"data"}', ServerSide.DATATYPE_ERROR);
					return null;
			}
		}
	}
	
}